<?php

$strSQL = "SELECT 
				  tblOrderHeader.* 
				, tblOrderHeader.ID											OrderID
				,  DATE_FORMAT(tblOrderHeader.OrderDate, '%D %M %Y' )		OrderDate
				,  DATE_FORMAT(tblOrderHeader.ShippedDate, '%D %M %Y' )		ShippedDate
				, tblOrderStatus.OrderStatus								Status
				, tblCourier.Courier										Courier
			FROM tblOrderHeader
				LEFT JOIN 
					tblOrderStatus ON 
					tblOrderHeader.OrderStatus = tblOrderStatus.ID
				LEFT JOIN 
					tblCourier ON 
					tblOrderHeader.Courier = tblCourier.ID";
   
    	if ($intCustomerID){
            $strJoin = " WHERE ";
            $strSQL .= $strJoin."tblOrderHeader.Customer =  '$intCustomerID'";
   		}
   
    $strSQL .= " ORDER BY tblOrderHeader.OrderDate, tblOrderStatus.OrderStatus";
    include (MODULE . "/action/actMySqlResults");
	//echo $strSQL;
?>
